a11y: Check display in `*grab_cell_focus()`
authorOlivier Fourdan <ofourdan@redhat.com>
Mon, 7 Jan 2019 21:06:57 +0000 (21:06 +0000)
committerDaniel Boles <dboles.src@gmail.com>
Mon, 7 Jan 2019 21:06:57 +0000 (21:06 +0000)
Calling the accessibility function `grab_focus()` on a `GtkCell` under
Wayland will cause the client to crash.

This is another case of `gdk_x11_get_server_time()` being called
regardless of the actual windowing backend used.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1507
gtk/a11y/gtktreeviewaccessible.c

index 37339ceb145baec18de500c4984fdfd120bb75f2..4c9f66fe9a4d00a565f4b567b1ef35a21765a1c6 100644 (file)
@@ -1174,11 +1174,12 @@ gtk_tree_view_accessible_grab_cell_focus (GtkCellAccessibleParent *parent,
       if (gtk_widget_is_toplevel (toplevel))
         {
 #ifdef GDK_WINDOWING_X11
-          gtk_window_present_with_time (GTK_WINDOW (toplevel),
-                                        gdk_x11_get_server_time (gtk_widget_get_surface (widget)));
-#else
-          gtk_window_present (GTK_WINDOW (toplevel));
+          if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (toplevel)))
+            gtk_window_present_with_time (GTK_WINDOW (toplevel),
+                                          gdk_x11_get_server_time (gtk_widget_get_surface (widget)));
+          else
 #endif
+            gtk_window_present (GTK_WINDOW (toplevel));
         }
 
       return TRUE;